package com.njupt.towerinfos.controller;

import com.njupt.towerinfos.domain.PredTowerChecks;
import com.njupt.towerinfos.domain.TowercheckResult;
import com.njupt.towerinfos.domain.Towers;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/tw")
@CrossOrigin("*")
public class CheckControl {
    @RequestMapping("/addTowerFix")
    public String addCheck(PredTowerChecks ptc){
        return "{\"gencheck\":\"232451\"}";
    }
    @RequestMapping("/addTowerInformation")
    public String checkResult(TowercheckResult tcr){
       return "{\"checkreg\":\"success\"}";
    }
    @RequestMapping("/checkTowerById")
    public PredTowerChecks findCheck(String towerid){
        return PredTowerChecks.builder()
                .checkdate(new Date())
                .checker("张三")
                .company("中铁建十一局")
                .managerid(5)
                .towerid("tw123123")
                .markdate(new Date())
                .markname("王一超")
                .result(TowercheckResult.builder()
                        .checkid("te123")
                        .broken(1)
                        .clean(1)
                        .ladder(1)
                        .limited(1)
                        .resid(10)
                        .waterfloor(1)
                        .build())
                .build();
    }

    @RequestMapping("/delTowerCheck")
    public String delTowerCheck(int towerid){
        return "{\"destory\":\"success\"}";
    }

}
